package day6;

import java.util.Random;
import java.util.Scanner;

public class RandomFigureGame {
    public static void main(String[] args) {
        Random a = new Random();
        int randomnum = a.nextInt(100) + 1;
        Scanner b = new Scanner(System.in);


        while (true) {
            System.out.println("请输入你猜测的数字");
            int guessnum = b.nextInt();
            if (randomnum > guessnum) {
                System.out.println("数字太小了，请重试");
            } else if (randomnum < guessnum) {
                System.out.println("数字太大了，请重试");
            } else {
                System.out.println("恭喜你，答对啦!");
                break;
            }
        }
        System.out.println("游戏结束");
    }
}
